<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<script type="text/javascript">
			function Parent(name="老陈",age=18) {
			  this.info = {
			    name: name,
			    age: age,
			  }
			}
			Parent.prototype.say = function(){
				console.log("我叫"+this.info.name)
			}
			
			function Child(name,age) {
			    Parent.call(this,name,age)
			}
			// 继承父类方法
			Child.prototype = new Parent();
			let child1 = new Child();
			child1.info.gender = "男";
			console.log(child1.info); // {name: "yhd", age: 19, gender: "男"};
			
			let child2 = new Child();
			console.log(child2.info); // {name: "yhd", age: 19}
		</script>
	</body>
</html>
